import sphRequest from '@/request/sph'

// get /cart/cartList
export const getCartList = function () {
  return sphRequest.get('/cart/cartList')
}

//post /api/cart/addToCart/{ skuId }/{ skuNum }
export const postAddToCart = function (skuId, skuNum) {
  return sphRequest.post(`/cart/addToCart/${skuId}/${skuNum}`)
}

//切换商品选中状态get /api/cart/checkCart/${skuID}/${isChecked}
export const getCheckCartById = function (skuID, isChecked) {
  return sphRequest.get(`/cart/checkCart/${skuID}/${isChecked}`)
}
// 批量选中购物车post /api/cart/batchCheckCart/{isChecked}
export const postBatchCheckCart = (isChecked, skuIdList) => {
  return sphRequest.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
}
//删除购物车商品 delete /api/cart/deleteCart/{skuId}
export const deleteCartBySkuId = function (skuId) {
  return sphRequest.delete(`/cart/deleteCart/${skuId}`)
}
//批量删除购物车  /api/cart/batchDeleteCart skuIdList
export const deleteBatchDeleteCart = function (skuIdList) {
  return sphRequest.post(`/cart/batchDeleteCart`, skuIdList)
}
